#!/bin/bash
# vagrant box add puppetlabs/centos-7.2-64-puppet centos-7.2-64-puppet

sudo passwd root
sudo systemctl stop firewalld
sudo systemctl disable firewalld
cd /etc/yum.repos.d/
sudo wget https://research.cs.wisc.edu/htcondor/yum/repo.d/htcondor-stable-rhel7.repo
wget http://research.cs.wisc.edu/htcondor/yum/RPM-GPG-KEY-HTCondor
rpm --import RPM-GPG-KEY-HTCondor
sudo yum install -y epel-release 
curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -
sudo yum install -y condor condor-python nano docker-io nodejs

cat | sudo tee /etc/condor/config.d/condor_config.local <<-EOF
DOCKER = /usr/bin/docker
ENABLE_SOAP = TRUE
ALLOW_SOAP = *
QUEUE_ALL_USERS_TRUSTED = TRUE
SCHEDD_ARGS = -p 8080
ALLOW_READ = *
ALLOW_WRITE = *
HOSTALLOW_READ = *
HOSTALLOW_WRITE = *
ALLOW_NEGOTIATOR = *
ALLOW_ADMINISTRATOR = *
COLLECTOR_DEBUG = D_FULLDEBUG
NEGOTIATOR_DEBUG = D_FULLDEBUG
MATCH_DEBUG = D_FULLDEBUG
SCHEDD_DEBUG = D_FULLDEBUG
START = TRUE
TRUST_UID_DOMAIN = TRUE
SOAP_LEAVE_IN_QUEUE = ((JobStatus==4) && ((ServerTime - CompletionDate) < (60 * 60 * 24)))
ENABLE_WEB_SERVER = TRUE
WEB_ROOT_DIR=/usr/share/condor/webservice/
USE_SHARED_PORT=FALSE
EOF

sudo groupadd docker
sudo gpasswd -a ${USER} docker
sudo gpasswd -a condor docker
newgrp docker
sudo service docker restart
sudo service condor restart

ps -ef | grep condor
condor_reconfig
condor_status -l | grep -i docker
condor_status -const HasDocker


#docker pull haskell
docker run -p 27017:27017 --name some-mongo -d mongo
docker run -d --hostname my-rabbit --name some-rabbit -p 8082:15672 -p 5672:5672 -e RABBITMQ_DEFAULT_USER=user -e RABBITMQ_DEFAULT_PASS=password rabbitmq:3-management-alpine
sudo npm install -g nodemon

cd

#docker pull elyase/staticpython
#docker pull openfoamplus/of_v30plus_rhel66
#docker pull gaetan/dockercraft
# https://hub.docker.com/_/busybox/
#docker pull busybox

#docker run -t -i -d -p 25565:25565 \
#-v /var/run/docker.sock:/var/run/docker.sock \
#--name dockercraft \
#gaetan/dockercraft

#docker pull centos
#docker run -t -i centos /bin/cat /etc/hosts
#ó
#docker ps -a
#docker start <container-id>
#docker attach <container-id>


#///---

#docker run -t -i -d --name openfoami docker.io/openfoamplus/of_v30plus_rhel66
#docker save -o /home/carlosro/Desktop haskell
#docker load -i 
